import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Item from './Item'
import Blank from './Blank'

export default class List extends Component {
    static propTypes = {
        list: PropTypes.array.isRequired
    }
    static defaultProps = {
        list: []
    }
    render() {
        let listContent = this.props.list.length ? <ul>{this.props.list.map(item => <Item
            key={item.id}
            detail={item}
        />)}</ul> : <Blank />;
        return (
            <div className='list-wrapper'>
                {listContent}
            </div>
        )
    }
}
